package es

import (
	"github.com/olivere/elastic/v7"
)

// -------------------------------------------- Distance -----------------------------------------
// distance
func (m *Model) Distance(name string, lat, lon float64, distance string) *Model {
	return m.AddFilter(elastic.NewGeoDistanceQuery(name).GeoPoint(elastic.GeoPointFromLatLon(lat, lon)).Distance(distance))
}